#include "dialogspeedometer.h"
#include "ui_dialogspeedometer.h"

DialogSpeedometer::DialogSpeedometer(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::DialogSpeedometer)
{
    ui->setupUi(this);
    btnGroup=new QButtonGroup(this);
    btnGroup->addButton(ui->radioButton_orhto,0);
    btnGroup->addButton(ui->radioButton_perspective,1);
    connect(ui->radioButton_orhto,&QRadioButton::clicked,this,&DialogSpeedometer::radioClicked);
    connect(ui->radioButton_perspective,&QRadioButton::clicked,this,&DialogSpeedometer::radioClicked);

    ui->radioButton_orhto->setChecked(true);
}

DialogSpeedometer::~DialogSpeedometer()
{
    delete ui;
}

void DialogSpeedometer::on_checkBox_stateChanged(int arg1)
{
    ui->openGLWidget->setPaintLine(arg1==2);
}

void DialogSpeedometer::on_horizontalSlider_valueChanged(int value)
{
    ui->openGLWidget->setSpeed(static_cast<float>(value)/10);
}

void DialogSpeedometer::on_horizontalSlider_2_valueChanged(int value)
{
    ui->openGLWidget->setRPM(static_cast<float>(value)/100);
}

void DialogSpeedometer::radioClicked()
{
    ui->openGLWidget->setortho(btnGroup->checkedId()==0);
}

